/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.opgea.qms.domain.entities;

import com.opgea.qms.domain.qualifiers.TokenStatusQualifier;
import java.io.Serializable;
import java.math.BigInteger;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToOne;
import javax.persistence.Table;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author Ramesh
 */
@Entity
@Table(name = "tokendetails")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "TokenDetails.findAll", query = "SELECT t FROM TokenDetails t"),
    @NamedQuery(name = "TokenDetails.findById", query = "SELECT t FROM TokenDetails t WHERE t.id = :id"),
    @NamedQuery(name = "TokenDetails.findByEmailId", query = "SELECT t FROM TokenDetails t WHERE t.emailId = :emailId"),
    @NamedQuery(name = "TokenDetails.findByMobileNo", query = "SELECT t FROM TokenDetails t WHERE t.mobileNo = :mobileNo"),
    @NamedQuery(name = "TokenDetails.findByFirstName", query = "SELECT t FROM TokenDetails t WHERE t.firstName = :firstName"),
    @NamedQuery(name = "TokenDetails.findByLastName", query = "SELECT t FROM TokenDetails t WHERE t.lastName = :lastName"),
    @NamedQuery(name = "TokenDetails.findByMiddleInitial", query = "SELECT t FROM TokenDetails t WHERE t.middleInitial = :middleInitial"),
    @NamedQuery(name = "TokenDetails.findByPrefix", query = "SELECT t FROM TokenDetails t WHERE t.prefix = :prefix"),
    @NamedQuery(name = "TokenDetails.findAllByCompanyId", query = "SELECT t FROM TokenDetails t WHERE t.token.company.id = :companyId"),
    @NamedQuery(name = "TokenDetails.findAllByDestination", query = "SELECT t FROM TokenDetails t WHERE t.token.company.id = :companyId  and t.destination.id = :destinationId")
})

public class TokenDetails implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "Id")
    private Long id;
    
    @Column(name = "emailId")
    private String emailId;
    
    @Column(name = "mobileNo")
    private BigInteger mobileNo;
    
    @Column(name = "firstName")
    private String firstName;
    
    @Column(name = "lastName")
    private String lastName;
    
    @Column(name = "middleInitial")
    private String middleInitial;
    
    @Column(name = "prefix")
    private Integer prefix;
    
    @JoinColumn(name = "token_id", referencedColumnName = "id")
    @OneToOne
    private Token token;
    
    @JoinColumn(name = "destination_id", referencedColumnName = "id")
    @ManyToOne
    private Destination destination;
    
    @Column(name = "tokenStatus")
    private TokenStatusQualifier tokenStatus;
    
    @Column(name = "metaData")
    private String metaData;

    public TokenDetails() {
    }

    public TokenDetails(Long id) {
        this.id = id;
    }

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getEmailId() {
        return emailId;
    }

    public void setEmailId(String emailId) {
        this.emailId = emailId;
    }

    public BigInteger getMobileNo() {
        return mobileNo;
    }

    public void setMobileNo(BigInteger mobileNo) {
        this.mobileNo = mobileNo;
    }

    public String getFirstName() {
        return firstName;
    }

    public void setFirstName(String firstName) {
        this.firstName = firstName;
    }

    public String getLastName() {
        return lastName;
    }

    public void setLastName(String lastName) {
        this.lastName = lastName;
    }

    public String getMiddleInitial() {
        return middleInitial;
    }

    public void setMiddleInitial(String middleInitial) {
        this.middleInitial = middleInitial;
    }

    public Integer getPrefix() {
        return prefix;
    }

    public void setPrefix(Integer prefix) {
        this.prefix = prefix;
    }

    public Token getToken() {
        return token;
    }

    public void setToken(Token token) {
        this.token = token;
    }

    public Destination getDestination() {
        return destination;
    }

    public void setDestination(Destination destination) {
        this.destination = destination;
    }

    public TokenStatusQualifier getTokenStatus() {
        return tokenStatus;
    }

    public void setTokenStatus(TokenStatusQualifier tokenStatus) {
        this.tokenStatus = tokenStatus;
    }

    public String getMetaData() {
        return metaData;
    }

    public void setMetaData(String metaData) {
        this.metaData = metaData;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof TokenDetails)) {
            return false;
        }
        TokenDetails other = (TokenDetails) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "TokenDetails{" + "id=" + id + ", emailId=" + emailId + ", mobileNo=" + mobileNo + ", firstName=" + firstName + ", lastName=" + lastName + ", middleInitial=" + middleInitial + ", prefix=" + prefix + ", token=" + token + ", destination=" + destination + ", tokenStatus=" + tokenStatus + '}';
    }


}
